<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Geometry manual page - Tk Themed Widget</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tk C API</a> <small>&gt;</small> ttk_Geometry</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="ttk_Geometry.htm#M2" NAME="L634">NAME</A>
<DL><DD>Ttk_MakeBox, Ttk_PadBox, Ttk_ExpandBox, Ttk_PackBox, Ttk_StickBox, Ttk_PlaceBox, Ttk_BoxContains, Ttk_MakePadding, Ttk_UniformPadding, Ttk_AddPadding, Ttk_RelievePadding, Ttk_GetPaddingFromObj, Ttk_GetBorderFromObj, Ttk_GetStickyFromObj &mdash; Tk themed geometry utilities</DD></DL>
<DD><A HREF="ttk_Geometry.htm#M3" NAME="L635">SYNOPSIS</A>
<DL>
<DD><B>#include &lt;tkTheme.h&gt;</B>
<DD>
<DD>Ttk_Box
<DD><B>Ttk_MakeBox</B>(int <I>x</I>, int <I>y</I>, int <I>width</I>, int <I>height</I>);
<DD>
<DD>Ttk_Box
<DD><B>Ttk_PadBox</B>(Ttk_Box <I>parcel</I>, Ttk_Padding <I>padding</I>);
<DD>
<DD>Ttk_Box
<DD><B>Ttk_ExpandBox</B>(Ttk_Box <I>parcel</I>, Ttk_Padding <I>padding</I>);
<DD>
<DD>Ttk_Box
<DD><B>Ttk_PackBox</B>(Ttk_Box *<I>cavity</I>, int <I>width</I>, int <I>height</I>, Ttk_Side <I>side</I>);
<DD>
<DD>Ttk_Box
<DD><B>Ttk_StickBox</B>(Ttk_Box <I>parcel</I>, int <I>width</I>, int <I>height</I>, unsigned <I>sticky</I>);
<DD>
<DD>Ttk_Box
<DD><B>Ttk_PlaceBox</B>(Ttk_Box *<I>cavity</I>, int <I>width</I>, int <I>height</I>, Ttk_Side <I>side</I>, unsigned <I>sticky</I>);
<DD>
<DD>Ttk_Box
<DD><B>Ttk_AnchorBox</B>(Ttk_Box <I>parcel</I>, int <I>width</I>, int <I>height</I>, Tk_Anchor <I>anchor</I>);
<DD>
<DD>Ttk_Padding
<DD><B>Ttk_MakePadding</B>(short <I>left</I>, short <I>top</I>, short <I>right</I>, short <I>bottom</I>);
<DD>
<DD>Ttk_Padding
<DD><B>Ttk_UniformPadding</B>(short <I>border</I>);
<DD>
<DD>Ttk_Padding
<DD><B>Ttk_AddPadding</B>(Ttk_Padding <I>padding1</I>, Ttk_Padding <I>padding2</I>;
<DD>
<DD>Ttk_Padding
<DD><B>Ttk_RelievePadding</B>(Ttk_Padding <I>padding</I>, int <I>relief</I>);
<DD>
<DD>int
<DD><B>Ttk_BoxContains</B>(Ttk_Box <I>box</I>, int <I>x</I>, int <I>y</I>);
<DD>
<DD>int
<DD><B>Ttk_GetPaddingFromObj</B>(Tcl_Interp *<I>interp</I>, Tk_Window <I>tkwin</I>, Tcl_Obj *<I>objPtr</I>, Ttk_Padding *<I>padding_rtn</I>);
<DD>
<DD>int
<DD><B>Ttk_GetBorderFromObj</B>(Tcl_Interp *<I>interp</I>, Tcl_Obj *<I>objPtr</I>, Ttk_Padding *<I>padding_rtn</I>);
<DD>
<DD>int
<DD><B>Ttk_GetStickyFromObj</B>(Tcl_Interp *<I>interp</I>, Tcl_Obj *<I>objPtr</I>, int *<I>sticky_rtn</I>);
</DL>
<DD><A HREF="ttk_Geometry.htm#M4" NAME="L636">ARGUMENTS</A>
<DL class="arguments">
</DL>
<DD><A HREF="ttk_Geometry.htm#M5" NAME="L637">BOXES</A>
<DD><A HREF="ttk_Geometry.htm#M6" NAME="L638">PADDDING</A>
<DD><A HREF="ttk_Geometry.htm#M7" NAME="L639">CONVERSION ROUTINES</A>
<DD><A HREF="ttk_Geometry.htm#M8" NAME="L640">SEE ALSO</A>
<DD><A HREF="ttk_Geometry.htm#M9" NAME="L641">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
Ttk_MakeBox, Ttk_PadBox, Ttk_ExpandBox, Ttk_PackBox, Ttk_StickBox, Ttk_PlaceBox, Ttk_BoxContains, Ttk_MakePadding, Ttk_UniformPadding, Ttk_AddPadding, Ttk_RelievePadding, Ttk_GetPaddingFromObj, Ttk_GetBorderFromObj, Ttk_GetStickyFromObj &mdash; Tk themed geometry utilities
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tkTheme.h&gt;</B><BR>
<BR>
Ttk_Box<BR>
<B>Ttk_MakeBox</B>(int <I>x</I>, int <I>y</I>, int <I>width</I>, int <I>height</I>);<BR>
<BR>
Ttk_Box<BR>
<B>Ttk_PadBox</B>(Ttk_Box <I>parcel</I>, Ttk_Padding <I>padding</I>);<BR>
<BR>
Ttk_Box<BR>
<B>Ttk_ExpandBox</B>(Ttk_Box <I>parcel</I>, Ttk_Padding <I>padding</I>);<BR>
<BR>
Ttk_Box<BR>
<B>Ttk_PackBox</B>(Ttk_Box *<I>cavity</I>, int <I>width</I>, int <I>height</I>, Ttk_Side <I>side</I>);<BR>
<BR>
Ttk_Box<BR>
<B>Ttk_StickBox</B>(Ttk_Box <I>parcel</I>, int <I>width</I>, int <I>height</I>, unsigned <I>sticky</I>);<BR>
<BR>
Ttk_Box<BR>
<B>Ttk_PlaceBox</B>(Ttk_Box *<I>cavity</I>, int <I>width</I>, int <I>height</I>, Ttk_Side <I>side</I>, unsigned <I>sticky</I>);<BR>
<BR>
Ttk_Box<BR>
<B>Ttk_AnchorBox</B>(Ttk_Box <I>parcel</I>, int <I>width</I>, int <I>height</I>, <A HREF="../TkLib/GetAnchor.htm">Tk_Anchor</A> <I>anchor</I>);<BR>
<BR>
Ttk_Padding<BR>
<B>Ttk_MakePadding</B>(short <I>left</I>, short <I>top</I>, short <I>right</I>, short <I>bottom</I>);<BR>
<BR>
Ttk_Padding<BR>
<B>Ttk_UniformPadding</B>(short <I>border</I>);<BR>
<BR>
Ttk_Padding<BR>
<B>Ttk_AddPadding</B>(Ttk_Padding <I>padding1</I>, Ttk_Padding <I>padding2</I>;<BR>
<BR>
Ttk_Padding<BR>
<B>Ttk_RelievePadding</B>(Ttk_Padding <I>padding</I>, int <I>relief</I>);<BR>
<BR>
int<BR>
<B>Ttk_BoxContains</B>(Ttk_Box <I>box</I>, int <I>x</I>, int <I>y</I>);<BR>
<BR>
int<BR>
<B>Ttk_GetPaddingFromObj</B>(<A HREF="../TclLib/Interp.htm">Tcl_Interp</A> *<I>interp</I>, <A HREF="../TkLib/WindowId.htm">Tk_Window</A> <I>tkwin</I>, <A HREF="../TclLib/Object.htm">Tcl_Obj</A> *<I>objPtr</I>, Ttk_Padding *<I>padding_rtn</I>);<BR>
<BR>
int<BR>
<B>Ttk_GetBorderFromObj</B>(<A HREF="../TclLib/Interp.htm">Tcl_Interp</A> *<I>interp</I>, <A HREF="../TclLib/Object.htm">Tcl_Obj</A> *<I>objPtr</I>, Ttk_Padding *<I>padding_rtn</I>);<BR>
<BR>
int<BR>
<B>Ttk_GetStickyFromObj</B>(<A HREF="../TclLib/Interp.htm">Tcl_Interp</A> *<I>interp</I>, <A HREF="../TclLib/Object.htm">Tcl_Obj</A> *<I>objPtr</I>, int *<I>sticky_rtn</I>);<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TkLib/GetAnchor.htm">Tk_Anchor</A> <B>anchor</B> (in)<DD>
One of the symbolic constants <B>TK_ANCHOR_N</B>, <B>TK_ANCHOR_NE</B>,
etc.  See <I><A HREF="../TkLib/GetAnchor.htm">Tk_GetAnchorFromObj</A>(3)</I>.
<P><DT>Ttk_Box * <B>cavity</B> (in/out)<DD>
A rectangular region from which a parcel is allocated.
<P><DT>short <B>border</B> (in)<DD>
Extra padding (in pixels) to add uniformly to each side of a region.
<P><DT>short <B>bottom</B> (in)<DD>
Extra padding (in pixels) to add to the bottom of a region.
<P><DT>Ttk_Box <B>box</B> (in)<DD>
Specifies a rectangular region.
<P><DT>Ttk_Box * <B>box_rtn</B> (out)<DD>
A rectangular region.
<P><DT>int <B>height</B> (in)<DD>
The height in pixels of a region.
<P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> * <B><A HREF="../TclCmd/interp.htm">interp</A></B> (in)<DD>
Used to store error messages.
<P><DT>int <B>left</B> (in)<DD>
Extra padding (in pixels) to add to the left side of a region.
<P><DT><A HREF="../TclLib/Object.htm">Tcl_Obj</A> * <B>objPtr</B> (in)<DD>
String value contains a symbolic name
to be converted to an enumerated value or bitmask.
Internal rep may be be modified to cache corresponding value.
<P><DT>Ttk_Padding <B>padding</B> (in)<DD>
Extra padding to add on the inside of a region.
<P><DT>Ttk_Padding * <B>padding_rtn</B> (out)<DD>
Padding present in the inside of a region.
<P><DT>Ttk_Box <B>parcel</B> (in)<DD>
A rectangular region, allocated from a cavity.
<P><DT>int <B>relief</B> (in)<DD>
One of the standard Tk relief options
(<B>TK_RELIEF_RAISED</B>, <B>TK_RELIEF_SUNKEN</B>, etc.).
See <B><A HREF="../TkLib/GetRelief.htm">Tk_GetReliefFromObj</A></B>.
<P><DT>short <B>right</B> (in)<DD>
Extra padding (in pixels) to add to the right side of a region.
<P><DT>Ttk_Side <B>side</B> (in)<DD>
One of <B>TTK_SIDE_LEFT</B>, <B>TTK_SIDE_TOP</B>,
<B>TTK_SIDE_RIGHT</B>, or <B>TTK_SIDE_BOTTOM</B>.
<P><DT>unsigned <B>sticky</B> (in)<DD>
A bitmask containing one or more of the bits
<B>TTK_STICK_W</B> (west, or left),
<B>TTK_STICK_E</B> (east, or right),
<B>TTK_STICK_N</B> (north, or top), and
<B>TTK_STICK_S</B> (south, or bottom).
<B>TTK_FILL_X</B> is defined as a synonym for (<B>TTK_STICK_W</B>|<B>TTK_STICK_E</B>),
<B>TTK_FILL_Y</B> is a synonym for (<B>TTK_STICK_N</B>|<B>TTK_STICK_S</B>),
and  <B>TTK_FILL_BOTH</B>
is a synonym for (<B>TTK_FILL_X</B>|<B>TTK_FILL_Y</B>).
See also: <I>grid(n)</I>.
<P><DT><A HREF="../TkLib/WindowId.htm">Tk_Window</A> <B>tkwin</B> (in)<DD>
Window whose screen geometry determines
the conversion between absolute units and pixels.
<P><DT>short <B>top</B> (in)<DD>
Extra padding at the top of a region.
<P><DT>int <B>width</B> (in)<DD>
The width in pixels of a region.
<P><DT>int <B>x</B> (in)<DD>
X coordinate of upper-left corner of region.
<P><DT>int <B>y</B> (in)<DD>
Y coordinate of upper-left corner of region.
<P></DL>
<H3><A NAME="M5">BOXES</A></H3>
The <B>Ttk_Box</B> structure represents a rectangular region of a window:
<PRE>typedef struct {
    int <I>x</I>;
    int <I>y</I>;
    int <I>width</I>;
    int <I>height</I>;
} <B>Ttk_Box</B>;</PRE>
All coordinates are relative to the window.
<P>
<B>Ttk_MakeBox</B> is a convenience routine that constructs
a <B>Ttk_Box</B> structure representing a region <I>width</I> pixels
wide, <I>height</I> pixels tall, at the specified <I>x, y</I> coordinates.
<P>
<B>Ttk_PadBox</B> returns a new box located inside the specified <I>parcel</I>,
shrunken according to the left, top, right, and bottom margins
specified by <I>padding</I>.
<P>
<B>Ttk_ExpandBox</B> is the inverse of <B>Ttk_PadBox</B>:
it returns a new box surrounding the specified <I>parcel</I>,
expanded  according to the left, top, right, and bottom margins
specified by <I>padding</I>.
<P>
<B>Ttk_PackBox</B> allocates a parcel <I>width</I> by <I>height</I>
pixels wide on the specified <I>side</I> of the <I>cavity</I>,
and shrinks the <I>cavity</I> accordingly.
<P>
<B>Ttk_StickBox</B> places a box with the requested <I>width</I>
and <I>height</I> inside the <I>parcel</I> according to the
<I>sticky</I> bits.
<P>
<B>Ttk_PlaceBox</B> combines <B>Ttk_PackBox</B> and <B>Ttk_StickBox</B>:
it allocates a parcel on the specified <I>side</I> of the <I>cavity</I>,
places a box of the requested size inside the parcel according to <I>sticky</I>,
and shrinks the <I>cavity</I>.
<P>
<B>Ttk_AnchorBox</B> places a box with the requested <I>width</I>
and <I>height</I> inside the <I>parcel</I> according to the
specified <I>anchor</I> option.
<P>
<B>Ttk_BoxContains</B> tests if the specified <I>x, y</I> coordinate
lies within the rectangular region <I>box</I>.
<H3><A NAME="M6">PADDDING</A></H3>
The <B>Ttk_Padding</B> structure is used to represent
borders, internal padding, and external margins:
<PRE>typedef struct {
    short <I>left</I>;
    short <I>top</I>;
    short <I>right</I>;
    short <I>bottom</I>;
} <B>Ttk_Padding</B>;</PRE>
<P>
<B>Ttk_MakePadding</B> is a convenience routine that constructs
a <B>Ttk_Padding</B> structure with the specified left, top, right, and bottom
components.
<P>
<B>Ttk_UniformPadding</B> constructs a <B>Ttk_Padding</B> structure
with all components equal to the specified <I>border</I>.
<P>
<B>Ttk_AddPadding</B> adds two <B>Ttk_Padding</B>s together
and returns a combined padding containing the sum of the
individual padding components.
<P>
<B>Ttk_RelievePadding</B>
adds an extra 2 pixels of padding to <I>padding</I>
according to the specified <I>relief</I>.
If <I>relief</I> is <B>TK_RELIEF_SUNKEN</B>,
adds two pixels at the top and left
so the inner region is shifted down and to the left.
If it is <B>TK_RELIEF_RAISED</B>, adds two pixels
at the bottom and right so
the inner region is shifted up and to the right.
Otherwise, adds 1 pixel on all sides.
This is typically used in element geometry procedures to simulate a
&ldquo;pressed-in&rdquo;
look for pushbuttons.
<H3><A NAME="M7">CONVERSION ROUTINES</A></H3>
<B>Ttk_GetPaddingFromObj</B> converts the string in <I>objPtr</I>
to a <B>Ttk_Padding</B> structure.
The string representation is a list of
up to four length specifications
&ldquo;<I>left top right bottom</I>&rdquo;.
If fewer than four elements are specified,
<I>bottom</I> defaults to <I>top</I>,
<I>right</I> defaults to <I>left</I>, and
<I>top</I> defaults to <I>left</I>.
See <B><A HREF="../TkLib/GetPixels.htm">Tk_GetPixelsFromObj(3)</A></B> for the syntax of length specifications.
<P>
<B>Ttk_GetBorderFromObj</B> is the same as <B>Ttk_GetPaddingFromObj</B>
except that the lengths are specified as integers
(i.e., resolution-dependent values like <I>3m</I> are not allowed).
<P>
<B>Ttk_GetStickyFromObj</B> converts the string in <I>objPtr</I>
to a <I>sticky</I> bitmask.  The string contains zero or more
of the characters <B>n</B>, <B>s</B>, <B>e</B>, or <B>w</B>.
<H3><A NAME="M8">SEE ALSO</A></H3>
<B><A HREF="../TkLib/GetRelief.htm">Tk_GetReliefFromObj</A></B>, <B><A HREF="../TkLib/GetPixels.htm">Tk_GetPixelsFromObj</A></B>, <B><A HREF="../TkLib/GetAnchor.htm">Tk_GetAnchorFromObj</A></B>
<H3><A NAME="M9">KEYWORDS</A></H3>
<A href="../Keywords/G.htm#geometry">geometry</A>, <A href="../Keywords/P.htm#padding">padding</A>, <A href="../Keywords/M.htm#margins">margins</A>, <A href="../Keywords/B.htm#box">box</A>, <A href="../Keywords/R.htm#region">region</A>, <A href="../Keywords/S.htm#sticky">sticky</A>, <A href="../Keywords/R.htm#relief">relief</A>
<div class="copy">Copyright &copy; 2004 Joe English
</div>
</BODY></HTML>
